package com.sjzxywlkj.cplife.alipay.result;

import java.util.HashMap;
import java.util.Map;

import com.alipay.api.AlipayApiException;
import com.alipay.api.response.AlipayEcoCplifePayResultQueryResponse;
import com.sjzxywlkj.cplife.alipay.conn.PayResultConn;
import com.sjzxywlkj.cplife.alipay.request.entity.PayResultquery;
import com.sjzxywlkj.cplife.alipay.response.entity.Assoc_bill_details;
import com.sjzxywlkj.cplife.alipay.response.entity.Fund_bill_list;
import com.sjzxywlkj.cplife.alipay.response.entity.PayResultqueryResult;
import com.sjzxywlkj.cplife.alipay.response.entity.PublicParameters;

/**
 * 查询单笔物业费交易关联账单详情操作返回结果
 */
public class PayResultQueryAlipay {

    public static Map<String, Object> query(PayResultquery payResultquery, String app_auth_token) throws AlipayApiException {
        AlipayEcoCplifePayResultQueryResponse response = PayResultConn.query(payResultquery, app_auth_token);

        Map<String, Object> result = new HashMap<String, Object>();
        PublicParameters parameters = new PublicParameters(response.getCode(), response.getMsg(), response.getSubCode(), response.getSubMsg(), null);

        Fund_bill_list fund_bill_list = new Fund_bill_list(response.getFundBillList().getFundChannel(), response.getFundBillList().getAmount());
        Assoc_bill_details assoc_bill_details = new Assoc_bill_details(response.getAssocBillDetails().getBillEntryId(), response.getAssocBillDetails().getBillEntryAmount(), response.getAssocBillDetails().getCostType(), response.getAssocBillDetails().getAcctPeriod());

        PayResultqueryResult parPayResultqueryResult = new PayResultqueryResult(response.getTradeNo(), response.getBuyerUserId(), response.getBuyerLogonId(), response.getSellerId(), response.getTradeStatus(), response.getTotalAmount(), response.getBizEntityId(), response.getBizType(), response.getGmtPayment(), fund_bill_list, assoc_bill_details);

        result.put("parameters", parameters);
        result.put("parPayResultqueryResult", parPayResultqueryResult);
        return result;

    }
}
